(pcase-mutually-exclusive): Use auto-generated table
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 28 Mar 2024 04:06:00 +0000 (00:06 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 28 Mar 2024 04:06:00 +0000 (00:06 -0400)
commitf1fe13ea057237f5426c93876488cb95be86156c
tree2fbdc9d4d5f69cefbb423171fd9dc8af25d2bdb4
parent1552f8345d8cbea282d171bffe5a22e330eeed37
(pcase-mutually-exclusive): Use auto-generated table

The `pcase-mutually-exclusive-predicates` table was not very
efficient since it grew like O(N²) with the number of
predicates.  Replace it with an O(N) table that's auto-generated
from the `built-in-class` objects.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Delete variable.
(pcase--subtype-bitsets): New function and constant.
(pcase--mutually-exclusive-p): Use them.
* lisp/emacs-lisp/cl-preloaded.el (built-in-class): Don't inline.
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/pcase.el
test/lisp/emacs-lisp/pcase-tests.el